<?php
include_once 'inc/config.inc.php';
include_once 'inc/mysql.inc.php';
include_once 'inc/tool.ins.php';
$link = connect();
$template['title'] = '注册';
if(isset($_POST['submit'])){
  include 'inc/check_register.php';
  $query = "insert into user(sid,username,password,sex,time) values({$_POST['sid']},'{$_POST['username']}', {$_POST['pwd']}, '{$_POST['sex']}', now() );";
  execute($link,$query);
   if(mysqli_affected_rows($link)==1){
              $_SESSION["username"]=$_POST['username'];
              skip('login.php','glyphicon-ok-sign','注册成功');

          }
          else{
               skip('register.php','glyphicon-remove-sign','注册失败,请重试');
          }
}


?>



<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <title>登录注册页面</title>
    <link rel="stylesheet" href="css/stylelogin.css">
    <link rel="stylesheet" href="https://unpkg.com/animate.css@3.5.2/animate.min.css" />
</head>

<body>
<div class="login-page animated fadeInUpBig">
    <div class="form">

        <form  method="post">
            <input placeholder="学号"  name="sid">
            <input placeholder="用户名"  name="username">
            <input placeholder="密码" name="pwd"  type="password">
            <input placeholder="性别" name="sex">
            <button name="submit">注册</button>
            <p class="message">已有账号? <a href="login.php">立即登录</a></p>
        </form>



    </div>
</div>



</body>

</html>